<?php
/*

入口文件 

*/
ini_set("display_errors","On");//开启错误显示
define('INDEX',true);

require_once 'Lib/Sing_core.php';

//$lastTime = time();
//redis2("set","shake_jiaoben",$lastTime);
$lastTime = redis2("get","shake_sh");
if(!$lastTime){
    $lastTime = 0;
}

echo $lastTime.'<br>';
echo (TIME-$lastTime).'<br>';
if(TIME-$lastTime<30){
    exit('还不能执行！');
}

$shake = new shake_insertlog();

//$shake->insert();

$lastTime = time();
redis2("set","shake_sh",$lastTime);

while(1){
    $shake->insert();
    
    DB::SetMainDB(DB_ESHOP);
    DB::object()->close();
    DB::SetMainDB(DB_MAIN);
    DB::object()->close();
    
    $stop = redis2("get","shake_sh_stop");
    if($stop){
        exit;
    }
    
    $lastTime = time();
    redis2("rm","shake_sh");
    redis2("set","shake_sh",$lastTime);
    echo $lastTime;
    sleep(5);
}